/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.camachosanchez.bean;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ZULLY
 */
@Entity
@Table(name = "estados_medicion")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EstadosMedicion.findAll", query = "SELECT e FROM EstadosMedicion e"),
    @NamedQuery(name = "EstadosMedicion.findById", query = "SELECT e FROM EstadosMedicion e WHERE e.id = :id"),
    @NamedQuery(name = "EstadosMedicion.findByNombre", query = "SELECT e FROM EstadosMedicion e WHERE e.nombre = :nombre")})
public class EstadosMedicion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Short id;
    @Basic(optional = false)
    @Column(name = "nombre")
    private String nombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEstado", fetch = FetchType.LAZY)
    private List<MedicionComprobacion> medicionComprobacionList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEstadoMedicion", fetch = FetchType.LAZY)
    private List<Neumaticos> neumaticosList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEstadoMedicion", fetch = FetchType.LAZY)
    private List<ConfiguracionBajaNeumatico> configuracionBajaNeumaticoList;

    public EstadosMedicion() {
    }

    public EstadosMedicion(Short id) {
        this.id = id;
    }

    public EstadosMedicion(Short id, String nombre) {
        this.id = id;
        this.nombre = nombre;
    }

    public Short getId() {
        return id;
    }

    public void setId(Short id) {
        this.id = id;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    @XmlTransient
    public List<MedicionComprobacion> getMedicionComprobacionList() {
        return medicionComprobacionList;
    }

    public void setMedicionComprobacionList(List<MedicionComprobacion> medicionComprobacionList) {
        this.medicionComprobacionList = medicionComprobacionList;
    }

    @XmlTransient
    public List<ConfiguracionBajaNeumatico> getConfiguracionBajaNeumaticoList() {
        return configuracionBajaNeumaticoList;
    }

    public void setConfiguracionBajaNeumaticoList(List<ConfiguracionBajaNeumatico> configuracionBajaNeumaticoList) {
        this.configuracionBajaNeumaticoList = configuracionBajaNeumaticoList;
    }
    
    @XmlTransient
    public List<Neumaticos> getNeumaticosList() {
        return neumaticosList;
    }

    public void setNeumaticosList(List<Neumaticos> neumaticosList) {
        this.neumaticosList = neumaticosList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EstadosMedicion)) {
            return false;
        }
        EstadosMedicion other = (EstadosMedicion) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return nombre;
    }
    
}
